package com.yfp.client.config;

import com.alipay.api.AlipayClient;
import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;

/**
 * @Description: 支付宝配置
 *
 * @CreateDate: 2024/6/20 17:43
 * @UpdateUser:
 * @UpdateDate: 2024/6/20 17:43
 * @UpdateRemark: 暂无修改
 * @Version: 1.0
 */
// @Configuration
@ConditionalOnClass(AlipayClient.class)
@EnableConfigurationProperties(AliPayProperties.class)
@AllArgsConstructor
public class AliPayConfiguration {
    private AliPayProperties aliPayProperties;
//    @Bean
//    @ConditionalOnMissingBean
//    public AlipayClient alipayClient() throws AlipayApiException {
//        CertAlipayRequest certAlipayRequest = new CertAlipayRequest();
//        certAlipayRequest.setServerUrl(aliPayProperties.getServerUrl());
//        certAlipayRequest.setAppId(aliPayProperties.getAppId());
////        certAlipayRequest.setPrivateKey();
//        certAlipayRequest.setFormat("json");
//        certAlipayRequest.setCharset(CHARSET);
//        certAlipayRequest.setSignType(SIGN_TYPE);
//        certAlipayRequest.setCertPath(aliPayProperties.getAppPublicPath());
//        certAlipayRequest.setAlipayPublicCertPath(aliPayProperties.getAliPayPublicPath());
//        certAlipayRequest.setRootCertPath(aliPayProperties.getAliPayRootCertPath());
//        DefaultAlipayClient alipayClient = new DefaultAlipayClient(certAlipayRequest);
//        // 提交数据至支付宝时请使用
////        alipayClient.certificateExecute(alipayClient);
//        return alipayClient;
//    }
}
